console.log("content");
chrome.runtime.onConnect.addListener(function(port){
	console.log("接收到了");
	port.onMessage.addListener(function(message){
		console.log(message.act);
		if (message.act == 'fetchPageSize') {
			var pageSize = {
				scrollHeight: document.body.scrollHeight,	
				scrollWidth: document.body.scrollWidth,
				clientWidth: document.documentElement.clientWidth,
				clientHeight: document.documentElement.clientHeight
			};
			//resCallback(pageSize);
			port.postMessage({pagesize: pageSize});
		} else if (message.act = 'scrollPage') {
			window.scrollBy(message.x, message.y);
			var pageSize = {};
			//resCallback(pageSize);
			port.postMessage({pagesize: pageSize});
		}
	});
});
